function faultChart() {
    var dom = document.getElementById("faultChart");
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {
        // title : {
        //     text: '设备故障情况',
        //     x:'center',
        //     textStyle: {
        //         color: 'white'
        //     }
        // },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: ['电信故障','设备故障','线圈故障','线路故障','其他故障'],
            textStyle: {
                color: 'white'
            }
        },
        series : [
            {
                name: '访问来源',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[
                    {value:335, name:'电信故障'},
                    {value:310, name:'设备故障'},
                    {value:234, name:'线圈故障'},
                    {value:135, name:'线路故障'},
                    {value:1548, name:'其他故障'}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    ;
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
}

function gaugeChartMain(id) {
    var dom = document.getElementById(id);
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {
        title : {
            text: '摄像机在线率',
            x:'center',
            textStyle: {
                color: 'white',
                fontSize: '24'
            }
        },
        tooltip : {
            formatter: "{a} <br/>{b} : {c}%"
        },
        series: [
            {
                name: '业务指标',
                type: 'gauge',
                detail: {formatter:'{value}%'},
                data: [{value: 33.3, name: ''}]
            }
        ]
    };

    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }

}

function gaugeChart(id) {
    var dom = document.getElementById(id);
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {
        title : {
            text: '摄像机在线率',
            x:'center',
            textStyle: {
                color: 'white',
            }
        },
        tooltip : {
            formatter: "{a} <br/>{b} : {c}%"
        },
        series: [
            {
                name: '业务指标',
                type: 'gauge',
                detail: {formatter:'{value}%'},
                data: [{value: 33.3, name: ''}],
                axisLabel:{
                   show:false
                },
            }
        ]
    };

    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }

}

$(function () {
    faultChart();
    gaugeChartMain('mainGauge');
    gaugeChart('guage1');
    gaugeChart('guage2');
    gaugeChart('guage3');
    gaugeChart('guage4');

});